package org.sample.springboot.model;

import org.sample.springboot.validator.constraints.optional.provider.OptionalProvider;

public class AccountHomeProvider implements OptionalProvider {
	
	@Override
	public boolean isEnabled(Object value) {
		Account passenger = (Account) value;
		Boolean hasHome = passenger.getHasHome();
		return hasHome != null && hasHome.booleanValue();
	}

	@Override
	public Object getOptionalValue(Object value) {
		Account passenger = (Account) value;
		return passenger.getHome();
	}

	@Override
	public String getOptionalFieldName() {
		return "home";
	}

}
